package com.wing.enterprisecab.order.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;

/**
 * 出/入库作业产品明细
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class InventoryJobLabel extends BaseEntity<InventoryJobLabel> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 出/入库作业id
     */
    private Long jobId;

    /**
     * ord_inventory_job_product表的主键
     */
    private Long jobProductId;

    /**
     * 平台sku id
     */
    private Long skuId;

    /**
     * 出库数量
     */
    private Long quantity;

    /**
     * 包装编码id
     */
    private Long packLabeId;

    /**
     * 包装编码
     */
    private String packLabeCode;
    /**
     * 包装规格描述id
     */
    private Long packId;

    /**
     * 包装规格名称
     */
    private String packName;
    /**
     * 单位包装数
     */
    private Long packLabeQuantity;


    private Long deliveryId;

    private Long deliveryDetailId;

    private Long warehouseId;

    private Long areaId;

    private Long shelfId;

    private Long spaceId;

    private Long boxId;

    private Long planId;

    public enum Status implements IEnum<Integer> {

        /**
         * 已创建
         */
        created(0,"已创建"),
        /**
         * 已签收
         */
        sign(1,"已签收"),
        /**
         * 已入库
         */
        storage(2,"已入库"),

        inventoryOut(3,"已出库"),

        /**
         * 已领货
         */
        receive(4,"已领货");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static Status jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (Status item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }

    }
    /**
     * 状态
     */
    private Status status;
    /**
     * 状态描述
     */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    public enum InoutType implements IEnum<Integer> {

        /**
         * 入库
         */
        in(1,"入库"),
        /**
         * 出库
         */
        out(2,"出库");

        private int code;
        private String desc;

        InoutType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

    }
    /**
     * 状态
     */
    private InoutType inoutType;
    /**
     * 状态描述
     */
    @TableField(exist = false)
    private String inoutTypeDesc;

    public String getInoutTypeDesc() {
        return inoutType == null ? null : inoutType.getDesc();
    }

    /**
     * 签收id
     */
    private Long signId;
    /**
     * 异常数
     */
    private Long abnormalQuantity;
    /**
     * 入库数
     */
    private Long storageQuantity;


    private Long receiveId;
}
